<template>
	<view class="container">
		<view class="example">
			<!-- 用户信息 -->
			<uni-section title="个人信息" type="line" padding>
				<!-- 只读表单展示 -->
				<uni-forms class="form-row" ref="baseForm" :model="baseFormData" v-if="baseFormData">
					<!-- 姓名 -->
					<uni-forms-item class="label" label="姓名">
						<uni-easyinput v-model="baseFormData.name">{{ baseFormData.name }}</uni-easyinput>
					</uni-forms-item>
					<!-- 年龄 -->
					<uni-forms-item class="label" label="年龄">
						<uni-easyinput v-model="baseFormData.age">{{ baseFormData.age }}</uni-easyinput>
					</uni-forms-item>
					<!-- 性别 -->
					<uni-forms-item class="label" label="性别">
						<uni-data-checkbox v-model="baseFormData.sex"
							:localdata="sexs">{{ baseFormData.sex === '男' ? '男' : '女'}}</uni-data-checkbox>
					</uni-forms-item>
					<!-- 地址 -->
					<uni-forms-item class="label" label="地址">
						<uni-easyinput v-model="baseFormData.address">{{ baseFormData.address}}</uni-easyinput>
					</uni-forms-item>
					<!-- 床位 -->
					<uni-forms-item class="label" label="床位">
						<picker class="form-item" mode="multiSelector" @columnchange="bindMultiPickerColumnChange"
							:value="bed" :range="multiArray">
							<view class="uni-input">
								{{multiArray[0][bed[0]]}}，{{multiArray[1][bed[1]]}}，{{multiArray[2][bed[2]]}}，
								{{multiArray[3][bed[3]]}}
							</view>
						</picker>
					</uni-forms-item>

					<!-- 其他备注 -->
					<uni-forms-item class="label" label="其他备注">
						<uni-easyinput type="textarea"
							v-model="baseFormData.introduction">{{ baseFormData.introduction }}</uni-easyinput>
					</uni-forms-item>
				</uni-forms>
			</uni-section>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 初始化为具有空值的对象，等待从后端加载真实数据
				baseFormData: {
					name: '',
					age: '',
					sex: '',
					address: '',
					bed: '',
					introduction: '',
					phone: uni.getStorageSync('userPhoneNumber'),
				},
				sexs: [{
					text: '男',
					value: '男'
				}, {
					text: '女',
					value: '女'
				}],
				multiArray: [
					['-区', 'A区', 'B区', 'C区'],
					['-楼', '1楼', '2楼', '3楼', '4楼', '5楼', '6楼', '7楼'],
					['-房', '1房', '2房', '3房', '4房', '5房', '6房', '7房'],
					['-床', '1床', '2床', '3床', '4床']
				],
				bed: [0, 0, 0, 0],
				deviceUUID: '',
			}
		},
		methods: {

		}
	}
</script>

<style>

</style>